import { apiClient } from './axios';

// 仪表盘相关接口
export const dashboardApi = {
  // 获取仪表板统计数据
  getStats: () => {
    return apiClient.get('/dashboard/stats');
  },

  // 获取最近工单
  getRecentWorkOrders: (params?: { limit?: number }) => {
    return apiClient.get('/dashboard/recent-work-orders', { params });
  },

  // 获取工单统计数据
  getWorkOrderStats: (params?: {
    start_date?: string;
    end_date?: string;
    area_id?: number;
  }) => {
    return apiClient.get('/dashboard/work-order-stats', { params });
  },

  // 获取材料使用统计
  getMaterialUsageStats: (params?: {
    start_date?: string;
    end_date?: string;
    material_id?: number;
  }) => {
    return apiClient.get('/dashboard/material-usage-stats', { params });
  },

  // 获取人员工作量统计
  getPersonnelWorkloadStats: (params?: {
    start_date?: string;
    end_date?: string;
    area_id?: number;
  }) => {
    return apiClient.get('/dashboard/personnel-workload-stats', { params });
  },

  // 获取区域工单分布
  getAreaWorkOrderDistribution: (params?: {
    start_date?: string;
    end_date?: string;
  }) => {
    return apiClient.get('/dashboard/area-work-order-distribution', { params });
  },

  // 获取工单趋势数据
  getWorkOrderTrends: (params?: {
    period?: 'day' | 'week' | 'month';
    start_date?: string;
    end_date?: string;
  }) => {
    return apiClient.get('/dashboard/work-order-trends', { params });
  },

  // 获取性能指标
  getPerformanceMetrics: (params?: {
    start_date?: string;
    end_date?: string;
    area_id?: number;
  }) => {
    return apiClient.get('/dashboard/performance-metrics', { params });
  }
};